package com.ymy.controller;

import com.ymy.vo.Result;
import com.ymy.vo.UserVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


@RestController
@Slf4j
public class TestController {

    /**
     * 测试
     * @return
     */
    @GetMapping(value = "/test")
    public Result test(){
        throw new RuntimeException();
       // return Result.OK();
    }


    /**
     * 添加用户
     * @return
     */
    @RequestMapping(value = "addUser",method = RequestMethod.POST)
    public Result addUser(@RequestBody @Valid UserVo userVo){

        log.info("添加成功。。。。。。{}",userVo);
        return Result.OK();
    }

    /**
     * 修啊给i用户信息
     *
     * @return
     */
    @RequestMapping(value = "/updateUser", method = RequestMethod.POST)
    public Result addUser() {
        int count = 1;
        log.info("第一步：删除基础信息。。。。。。。。。。。");


        log.info("第二步：删除详细信息。。。。。。。。。。。");

        log.info("第三步：删除图像信息。。。。。。。。。。。，结果返回了0，表示删除失败");
        count = 0;
        if(count == 0){
            throw  new MyException("delete_excption","删除图像信息失败，请过一会在尝试");
        }

        return Result.OK();

    }
}
